package com.icedevcloud.shardingsphere.data;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.icedevcloud.shardingsphere.entity.LabOrder;
import com.icedevcloud.shardingsphere.mapper.LabOrderMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.math.BigDecimal;

@SpringBootTest
class DataOptTests2 {

    @Autowired
    private LabOrderMapper labOrderMapper;

    @Test
    public void saveDate() {
        for (int i = 0; i < 10000000; i++) {
            LabOrder labOrder = new LabOrder();
            labOrder.setOrderNo(IdWorker.getIdStr());
            labOrder.setTotalAmount(new BigDecimal(i + ""));
            labOrder.setUserId(IdWorker.getId());
            try {
                labOrderMapper.insert(labOrder);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

}
